package com.example.demo;


import com.example.demo.model.ReadList;
import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class UserController {

    @Value("${server.port}") // 读取配置项
    private String port;

    @Value("${myyml.string}") // 读取配置项
    private String myyml;

    @Value("${mystring1}") // 读取配置项
    private String mystring1;

    @Value("${mystring2}") // 读取配置项
    private String mystring2;

    @Value("${mystring3}") // 读取配置项
    private String mystring3;

    @Value("${mystring4}") // 读取配置项
    private String mystring4;

    @Autowired
    private Student student;

    @Resource
    private ReadList readList;

    @ResponseBody // 返回一个非静态页面的数据
    @RequestMapping("/sayhi") // 设置路由地址 sayHi
    public String sayHi(){
//        System.out.println("myyml："+myyml);
//
//        System.out.println("mystring1："+mystring1);
//        System.out.println("mystring2："+mystring2);
//        System.out.println("mystring3："+mystring3);
//        System.out.println("mystring4："+mystring4);
//
//        return "Hello, World!!! | port："+port;
       //return "student："+student;
       return "readList："+readList.getName();
    }
}
